package xyj.sparrow.scheduler.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import xyj.sparrow.scheduler.entity.Task;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author jim
 * @since 2021-06-05
 */
public interface TaskMapper extends BaseMapper<Task> {

    @Select("select task.* from task,app where task.app_id=app.app_id and task.task_status=1 and app.app_status=1 ")
    List<Task> listTaskOfEnable();

    @Select("select task.* from task,app where task.app_id=app.app_id and task.task_status=1 and app.app_status=1 and" +
            " task.task_id=#{taskId}")
    Task getTaskOfEnableByTaskId(@Param("taskId") String taskId);

    @Select("select task.* from task,app where task.app_id=app.app_id and task.task_status=1 and app.app_status=1 and" +
            " app.app_id=#{appId}")
    List<Task> listTaskOfEnableByAppId(@Param("appId") String appId);
}
